# output
# hyprctl monitors
# monitor = LVDS-1, 1366x768, 0x0, 1
# monitor = HDMI-1, 1920x1080, 1366x0, 1
monitor = , preferred, auto, auto

# variables
$mod = SUPER
$term = footclient
$scripts = ~/.config/hypr/scripts

# startup programs
exec-once = foot -s
exec-once = hypridle
exec-once = $scripts/wallpaper
exec-once = $scripts/gamma
exec = pkill -SIGUSR2 waybar || waybar

# input
# hyprctl devices
input {
    kb_options = caps:escape
    repeat_rate = 50
    repeat_delay = 300
    mouse_refocus = false
}

# cursor
env = XCURSOR_THEME, Adwaita
cursor:inactive_timeout = 5

# appearance
source = ~/.config/hypr/themes/kanagawa.conf

general {
    border_size = 2
    gaps_in = 0
    gaps_out = 0
    col.active_border = rgb($magenta)
    col.inactive_border = rgb($brightblack)
    layout = master
    resize_on_border = true
}

decoration {
    blur:enabled = false
    shadow:enabled = false
}

animations:enabled = false

# tiling
master {
    new_status = master
    new_on_top = true
}

# miscellaneous
misc {
    disable_hyprland_logo = true
    disable_autoreload = true
    new_window_takes_over_fullscreen = 1
    initial_workspace_tracking = 0
}

# window rules
windowrulev2 = workspace 1 silent, class:^(firefox)$
windowrulev2 = workspace 9 silent, title:^(cplay)$

# workspace rules
workspace = w[t1], border:0
workspace = f[1], border:0

# reload config
bind = $mod SHIFT, R, exec, hyprctl reload

# session menu
bind = CTRL ALT, Delete, exec, pkill fuzzel || $scripts/session

# program bindings
bind = $mod SHIFT, Return, exec, $term
bind = $mod, P, exec, pkill fuzzel || fuzzel
bind = $mod SHIFT, W, exec, firefox
bind = $mod SHIFT, F, exec, $term -e lf
bind = $mod SHIFT, E, exec, $term -e nvim
bind = $mod SHIFT, N, exec, $term -e newsraft
bind = $mod SHIFT, T, exec, { pidof transmission-daemon || transmission-daemon; } && firefox 127.0.0.1:9091
bind = , Print, exec, pkill slurp || grim -g "$(slurp)" - | wl-copy
bind = SHIFT, Print, exec, pkill slurp || grim -g "$(slurp)"
bind = $mod SHIFT, G, exec, $scripts/gamma

# media bindings
bindel = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-
bindel = , XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 2%+
bindl = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindl = , XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bindl = , XF86AudioPlay, exec, { pidof cmus && cmus-remote -u; } || $term -T cplay -e cmus
bindl = , XF86AudioNext, exec, cmus-remote -n
bindl = , XF86AudioPrev, exec, cmus-remote -r
binde = $mod, minus, exec, cmus-remote -C "vol -5%"
binde = $mod, equal, exec, cmus-remote -C "vol +5%"

# mouse bindings
bindm = $mod, mouse:272, movewindow
bindm = $mod, mouse:273, resizewindow
bind = $mod, mouse_up, workspace, e-1
bind = $mod, mouse_down, workspace, e+1

# toggle maximize
bind = $mod, M, fullscreen, 1

# toggle fullscreen
bind = $mod, F, fullscreen

# toggle floating
bind = $mod SHIFT, space, togglefloating
bind = $mod SHIFT, space, centerwindow

# kill active window
bind = $mod SHIFT, C, killactive

# cycle windows
bind = $mod, J, layoutmsg, cyclenext
bind = $mod, K, layoutmsg, cycleprev

# resize window
binde = $mod, H, resizeactive, -10 0
binde = $mod, L, resizeactive, 10 0

# swap active window with master
bind = $mod, Return, layoutmsg, swapwithmaster master

# switch to workspace
bind = $mod, 1, focusworkspaceoncurrentmonitor, 1
bind = $mod, 2, focusworkspaceoncurrentmonitor, 2
bind = $mod, 3, focusworkspaceoncurrentmonitor, 3
bind = $mod, 4, focusworkspaceoncurrentmonitor, 4
bind = $mod, 5, focusworkspaceoncurrentmonitor, 5
bind = $mod, 6, focusworkspaceoncurrentmonitor, 6
bind = $mod, 7, focusworkspaceoncurrentmonitor, 7
bind = $mod, 8, focusworkspaceoncurrentmonitor, 8
bind = $mod, 9, focusworkspaceoncurrentmonitor, 9

# switch to previous workspace
bind = $mod, Tab, workspace, previous

# move active window to workspace
bind = $mod SHIFT, 1, movetoworkspacesilent, 1
bind = $mod SHIFT, 2, movetoworkspacesilent, 2
bind = $mod SHIFT, 3, movetoworkspacesilent, 3
bind = $mod SHIFT, 4, movetoworkspacesilent, 4
bind = $mod SHIFT, 5, movetoworkspacesilent, 5
bind = $mod SHIFT, 6, movetoworkspacesilent, 6
bind = $mod SHIFT, 7, movetoworkspacesilent, 7
bind = $mod SHIFT, 8, movetoworkspacesilent, 8
bind = $mod SHIFT, 9, movetoworkspacesilent, 9

# cycle monitors
bind = $mod, comma, focusmonitor, l
bind = $mod, period, focusmonitor, r

# move active workspace to monitor
bind = $mod SHIFT, less, movecurrentworkspacetomonitor, l
bind = $mod SHIFT, greater, movecurrentworkspacetomonitor, r
